﻿using Fibot.Module.K3Cloud.BASE.dto;

namespace Fibot.Module.K3Cloud.SAL.dto;

public class OutStockDto
{
}

public class OutStockHeaderDto
{
    /// <summary>
    /// 实体主键
    /// </summary>
    public int FID { get; set; }

    public string FBillNo{ get; set; }

    /// <summary>
    /// 单据类型
    /// </summary>
    public BaseBasicDataDto FBillTypeID { get; set; } = new BaseBasicDataDto();

    /// <summary>
    /// 日期
    /// </summary>
    public DateTime FDate { get; set; } = DateTime.Now;

    /// <summary>
    /// 销售组织
    /// </summary>
    public BaseBasicDataDto FSaleOrgId { get; set; } = new BaseBasicDataDto();

    /// <summary>
    /// 客户
    /// </summary>
    public BaseBasicDataDto FCustomerID { get; set; } = new BaseBasicDataDto();

    /// <summary>
    ///  收货方
    /// </summary>
    public BaseBasicDataDto FReceiverID { get; set; } = new BaseBasicDataDto();

    /// <summary>
    /// 发货组织
    /// </summary>
    public BaseBasicDataDto FStockOrgId { get; set; } = new BaseBasicDataDto();

    /// <summary>
    /// 收货人姓名
    /// </summary>
    public string FLinkMan { get; set; } = "";

    /// <summary>
    /// 收货方地址
    /// </summary>
    public string FReceiveAddress { get; set; } = "";

    /// <summary>
    /// 结算方
    /// </summary>
    public BaseBasicDataDto FSettleID { get; set; } = new BaseBasicDataDto();

    /// <summary>
    /// 付款方
    /// </summary>
    public BaseBasicDataDto FPayerID { get; set; } = new BaseBasicDataDto();

    /// <summary>
    /// 货主类型
    /// </summary>
    public string FOwnerTypeIdHead { get; set; } = "BD_OwnerOrg";

    /// <summary>
    /// 整单服务或费用
    /// </summary>
    public bool FIsTotalServiceOrCost = false;

    /// <summary>
    /// 财务信息
    /// </summary>
    public OutStockSubHeadEntity SubHeadEntity { get; set; }

    /// <summary>
    /// 明细信息
    /// </summary>
    public List<OutStockEntryDto> FEntity { get; set; }
}

/// <summary>
/// 财务信息
/// </summary>
public class OutStockSubHeadEntity 
{
    /// <summary>
    /// 结算币别
    /// </summary>
    public BaseBasicDataDto FSettleCurrID { get; set; } = new BaseBasicDataDto();
    /// <summary>
    /// 结算组织
    /// </summary>
    public BaseBasicDataDto FSettleOrgID { get; set; } = new BaseBasicDataDto();
    /// <summary>
    /// 是否含税
    /// </summary>
    public bool FIsIncludedTax { get; set; }
    /// <summary>
    /// 本位币
    /// </summary>
    public BaseBasicDataDto FLocalCurrID { get; set; } = new BaseBasicDataDto();
    /// <summary>
    /// 汇率
    /// </summary>
    public decimal FExchangeRate { get; set; }
    /// <summary>
    /// 价外税
    /// </summary>
    public bool FIsPriceExcludeTax { get; set; }
}

/// <summary>
/// 明细信息
/// </summary>
public class OutStockEntryDto
{
    /// <summary>
    /// 产品类型
    /// </summary>
    public string FRowType { get; set; } = "Standard";
    /// <summary>
    /// 物料编码
    /// </summary>
    public BaseBasicDataDto FMaterialID { get; set; } = new BaseBasicDataDto();
    /// <summary>
    /// 库存单位
    /// </summary>
    public BaseBasicDataDto FUnitID { get; set; } = new BaseBasicDataDto();
    /// <summary>
    /// 实发数量
    /// </summary>
    public decimal FRealQty { get; set; }
    /// <summary>
    /// 是否赠品
    /// </summary>
    public bool FIsFree { get; set; }
    /// <summary>
    /// 货主类型
    /// </summary>
    public string FOwnerTypeID { get; set; } = "";
    /// <summary>
    /// 货主
    /// </summary>
    public BaseBasicDataDto FOwnerID { get; set; } = new BaseBasicDataDto();
    /// <summary>
    /// 批号
    /// </summary>
    public BaseBasicDataDto FLot { get; set; } = new BaseBasicDataDto();
    /// <summary>
    /// 税率%
    /// </summary>
    public decimal FEntryTaxRate { get; set; }
    /// <summary>
    /// 仓库
    /// </summary>
    public BaseBasicDataDto FStockID { get; set; } = new BaseBasicDataDto();
    /// <summary>
    /// 库存状态
    /// </summary>
    public BaseBasicDataDto FStockStatusID { get; set; } = new BaseBasicDataDto();
    /// <summary>
    /// 销售单位
    /// </summary>
    public BaseBasicDataDto FSalUnitID { get; set; } = new BaseBasicDataDto();
    /// <summary>
    /// 销售数量
    /// </summary>
    public decimal FSALUNITQTY { get; set; }
    /// <summary>
    /// 销售基本数量
    /// </summary>
    public decimal FSALBASEQTY { get; set; }
    /// <summary>
    /// 计价基本数量
    /// </summary>
    public decimal FPRICEBASEQTY { get; set; }
    /// <summary>
    /// 控制出库数量
    /// </summary>
    public bool FOUTCONTROL { get; set; } = false;
    /// <summary>
    /// 组织间结算跨法人标识
    /// </summary>
    public bool FIsOverLegalOrg { get; set; } = false;
    /// <summary>
    /// 关联应收金额
    /// </summary>
    public decimal FARNOTJOINQTY { get; set; }
    /// <summary>
    /// 发货检验
    /// </summary>
    public bool FCheckDelivery { get; set; } = false;
    /// <summary>
    /// 按子项结算
    /// </summary>
    public bool FSettleBySon { get; set; } = false;
    /// <summary>
    /// 物料（销售组织）
    /// </summary>
    public BaseBasicDataDto FMaterialID_Sal { get; set; } = new BaseBasicDataDto();
    /// <summary>
    /// VMI业务
    /// </summary>
    public bool FVmiBusinessStatus { get; set; } = false;
    /// <summary>
    /// 价税合计
    /// </summary>
    public decimal FAllAmount { get; set; }

    /// <summary>
    /// 税额
    /// </summary>
    public decimal FTAXPRICE { get; set; }

    /// <summary>
    /// 单价
    /// </summary>
    public decimal FPRICE { get; set; }

    /// <summary>
    /// 税额
    /// </summary>
    public decimal FEntryTaxAmount { get; set; }

    /// <summary>
    /// 
    /// </summary>
    public decimal FAMOUNT { get; set; }

    public string FEntrynote { get; set; } = "";

    public BaseBasicDataDto FAuxUnitID { get; set; } = new BaseBasicDataDto();

    public decimal FAuxUnitQty { get; set; }

    public BaseBasicDataDto FExtAuxUnitId { get; set; } = new BaseBasicDataDto();

    public decimal FExtAuxUnitQty { get; set; }

}